package com.xy.pattern.prototype;

import java.util.Objects;

public class Main {
    public static void main(String[] args) throws CloneNotSupportedException {
        Location location1 = new Location("1", "11");
        Person p1 = new Person();
        p1.setId("p1");
        p1.setName("p1name");
        p1.setLoc(location1);
        Person p2 = (Person) p1.clone();

        System.out.println(p1);
        p1.setId("11");
        location1.setRoomNo("2");
        System.out.println("-----");
        System.out.println(p2);
    }
}
